load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("scm_server_infra")

rust_library(
    name = "repo_client",
    srcs = glob([
        "src/**/*.rs",
    ]),
    named_deps = {
        "futures-old": "fbsource//third-party/rust:futures-old",
        "slog": "//common/rust/shed/tracing_slog_compat:tracing_slog_compat",
    },
    test_deps = [
        "fbcode//common/rust/shed/fbinit:fbinit",
        "fbsource//third-party/rust:tokio",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//eden/mononoke/bookmarks:warm_bookmarks_cache",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_types:mononoke_types-mocks",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/repo_attributes/repo_event_publisher:repo_event_publisher",
        "//eden/mononoke/repo_factory:test_repo_factory",
        "//eden/mononoke/tests/fixtures:fixtures",
        "//eden/mononoke/tests/utils:tests_utils",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:itertools",
        "fbsource//third-party/rust:lazy_static",
        "fbsource//third-party/rust:maplit",
        "fbsource//third-party/rust:nonzero_ext",
        "fbsource//third-party/rust:percent-encoding",
        "fbsource//third-party/rust:rand",
        "fbsource//third-party/rust:serde",
        "fbsource//third-party/rust:serde_json",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tracing",
        ":getbundle_response",
        ":remotefilelog",
        ":streaming_clone",
        ":unbundle",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/facet:facet",
        "//common/rust/shed/futures_01_ext:futures_01_ext",
        "//common/rust/shed/futures_ext:futures_ext",
        "//common/rust/shed/futures_stats:futures_stats",
        "//common/rust/shed/hostname:hostname",
        "//common/rust/shed/justknobs_stub:justknobs",
        "//common/rust/shed/stats:stats",
        "//common/rust/shed/time_ext:time_ext",
        "//eden/mononoke/blobrepo:blobrepo_hg",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/bonsai_git_mapping:bonsai_git_mapping",
        "//eden/mononoke/bonsai_globalrev_mapping:bonsai_globalrev_mapping",
        "//eden/mononoke/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/bookmarks:bookmarks",
        "//eden/mononoke/bookmarks:bookmarks_cache",
        "//eden/mononoke/bookmarks:bookmarks_types",
        "//eden/mononoke/common/iterhelpers:iterhelpers",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "//eden/mononoke/features/cross_repo_sync:cross_repo_sync",
        "//eden/mononoke/filenodes:filenodes",
        "//eden/mononoke/filestore:filestore",
        "//eden/mononoke/git_source_of_truth:git_source_of_truth",
        "//eden/mononoke/hgproto:hgproto",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/mercurial:mercurial_bundles",
        "//eden/mononoke/mercurial:mercurial_mutation",
        "//eden/mononoke/mercurial:mercurial_revlog",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/mutable_counters:mutable_counters",
        "//eden/mononoke/phases:phases",
        "//eden/mononoke/pushrebase_mutation_mapping:pushrebase_mutation_mapping",
        "//eden/mononoke/rate_limiting:rate_limiting",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
        "//eden/mononoke/repo_attributes/hook_manager/hook_manager:hook_manager",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_bookmark_attrs:repo_bookmark_attrs",
        "//eden/mononoke/repo_attributes/repo_cross_repo:repo_cross_repo",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/repo_attributes/repo_event_publisher:repo_event_publisher",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/repo_attributes/repo_lock:repo_lock",
        "//eden/mononoke/repo_attributes/repo_permission_checker:repo_permission_checker",
        "//eden/mononoke/repo_attributes/sql_query_config:sql_query_config",
        "//eden/mononoke/repo_authorization:repo_authorization",
        "//eden/mononoke/server/context:context",
        "//eden/scm/lib/revisionstore:revisionstore_types",
    ],
)

rust_library(
    name = "remotefilelog",
    srcs = glob(["remotefilelog/src/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "remotefilelog"},
    test_deps = [
        "fbsource//third-party/rust:assert_matches",
        "fbsource//third-party/rust:futures",
        "//common/rust/shed/borrowed:borrowed",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/repo_factory:test_repo_factory",
        "//eden/mononoke/tests/utils:tests_utils",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:thiserror",
        ":getbundle_response",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/facet:facet",
        "//eden/mononoke/blobrepo:blobrepo_hg",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/blobstore:redactedblobstore",
        "//eden/mononoke/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/filenodes:filenodes",
        "//eden/mononoke/filestore:filestore",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/server/context:context",
        "//eden/scm/lib/revisionstore:revisionstore_types",
    ],
)

rust_library(
    name = "streaming_clone",
    srcs = glob(["streaming_clone/src/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "streaming_clone"},
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:thiserror",
        "//common/rust/shed/facet:facet",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/common/rust/sql_ext:sql_ext",
        "//eden/mononoke/common/sql_construct:sql_construct",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/repo_attributes/mutable_blobstore:mutable_blobstore",
        "//eden/mononoke/server/context:context",
    ],
)

rust_library(
    name = "obsolete",
    srcs = glob(["obsolete/src/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "obsolete"},
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:futures",
        "//common/rust/shed/cloned:cloned",
        "//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "//eden/mononoke/mercurial:mercurial_bundles",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/pushrebase:pushrebase",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/server/context:context",
    ],
)

rust_library(
    name = "unbundle",
    srcs = glob(["unbundle/src/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "unbundle"},
    test_deps = [
        "fbsource//third-party/rust:itertools",
        "fbsource//third-party/rust:quickcheck_async",
        "fbsource//third-party/rust:quickcheck_macros",
        "fbsource//third-party/rust:tokio",
        "//common/rust/shed/facet:facet",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//eden/mononoke/mercurial:mercurial_types-mocks",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/repo_factory:test_repo_factory",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:ascii",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:lazy_static",
        "fbsource//third-party/rust:pin-project",
        "fbsource//third-party/rust:quickcheck",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tracing",
        ":getbundle_response",
        ":obsolete",
        ":remotefilelog",
        ":wirepack",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/futures_ext:futures_ext",
        "//common/rust/shed/futures_stats:futures_stats",
        "//common/rust/shed/justknobs_stub:justknobs",
        "//common/rust/shed/stats:stats",
        "//eden/mononoke/blobrepo:blobrepo_hg",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/bookmarks:bookmarks",
        "//eden/mononoke/bookmarks:bookmarks_movement",
        "//eden/mononoke/commit_rewriting/backsyncer:backsyncer",
        "//eden/mononoke/commit_rewriting/live_commit_sync_config:live_commit_sync_config",
        "//eden/mononoke/commit_rewriting/synced_commit_mapping:synced_commit_mapping",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/common/topo_sort:topo_sort",
        "//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "//eden/mononoke/features/cross_repo_sync:cross_repo_sync",
        "//eden/mononoke/features/repo_update_logger:repo_update_logger",
        "//eden/mononoke/filestore:filestore",
        "//eden/mononoke/hooks:hooks",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/mercurial:mercurial_bundles",
        "//eden/mononoke/mercurial:mercurial_mutation",
        "//eden/mononoke/mercurial:mercurial_revlog",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/phases:phases",
        "//eden/mononoke/pushrebase:pushrebase",
        "//eden/mononoke/pushrebase:pushrebase_client",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
        "//eden/mononoke/repo_attributes/hook_manager/hook_manager:hook_manager",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/repo_authorization:repo_authorization",
        "//eden/mononoke/server/context:context",
        "//eden/mononoke/wireproto_handler:wireproto_handler",
    ],
)

rust_library(
    name = "getbundle_response",
    srcs = glob(["getbundle_response/src/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "getbundle_response"},
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:faster-hex",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:futures-util",
        "fbsource//third-party/rust:sha1",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tracing",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/futures_ext:futures_ext",
        "//common/rust/shed/futures_stats:futures_stats",
        "//eden/mononoke/blobrepo:blobrepo_hg",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/derived_data/filenodes_derivation:filenodes_derivation",
        "//eden/mononoke/filestore:filestore",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/mercurial:mercurial_bundles",
        "//eden/mononoke/mercurial:mercurial_mutation",
        "//eden/mononoke/mercurial:mercurial_revlog",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/phases:phases",
        "//eden/mononoke/rate_limiting:rate_limiting",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/server/context:context",
    ],
)

rust_library(
    name = "wirepack",
    srcs = glob(["wirepack/src/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "wirepack"},
    test_deps = [
        "fbsource//third-party/rust:maplit",
        "fbsource//third-party/rust:tokio",
        "//eden/mononoke/mercurial:mercurial_types-mocks",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:thiserror",
        "//eden/mononoke/mercurial:mercurial_bundles",
        "//eden/mononoke/mercurial:mercurial_revlog",
        "//eden/mononoke/mercurial:mercurial_types",
    ],
)
